<template>
  <section>
    <h2>子传父-父组件</h2>
    <p>子组件传来的值：{{value}}</p>
    <sub-to-parent @sendData="handleSendData"></sub-to-parent>
  </section>
</template>

<script>

import SubToParent from "./sub-to-parent"
import {ref} from "vue";

export default {
    components: {SubToParent},

    setup() {

        const value = ref("");

        function handleSendData(val) {
            value.value = val;
        }

        return {
            value,handleSendData
        }
    }
}
</script>

<style>

</style>